<extend name="./public/frame.html"/>
<block name="content">
	<blockquote class="layui-elem-quote search">
		<div class="layui-inline">
            <input type="text" name="complain_message" placeholder="投诉内容" class="layui-input" id="complain_message">
        </div>
		<div class="layui-inline">
			<button class="layui-btn" data-type="search">搜索</button>
			<button class="layui-btn layui-btn-normal" data-url="{:url('add')}" onclick="add_t(this,'添加配置')">
				添加配置
			</button>
		</div>
	</blockquote>
	<table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('ComplainMessage/index')}', page: true, limit: 10, id:'ComplainMessage'}" lay-filter="ComplainMessage">
		<thead>
		<tr>
			<th lay-data="{field:'complain_id', width:70,fixed: true, sort: true,align:'center',fixed: true}">ID</th>
			<th lay-data="{field:'complain_message', width:200,align:'center'}">投诉内容</th>
			<th lay-data="{field:'orderTypeName', width:160,align:'center'}">所属类型</th>
			<th lay-data="{field:'appName', width:160,align:'center'}">所属应用</th>
			<th lay-data="{field:'sort', width:100,align:'center'}">排序</th>
			<th lay-data="{field:'admin_name', width:160,align:'center'}">操作人</th>
			<th lay-data="{field:'add_time', width:160,align:'center'}">添加时间</th>
			<th lay-data="{field:'update_time', width:160,align:'center'}">修改时间</th>
			<th lay-data="{fixed:'right', toolbar: '#barDemo', width:150, align:'center'}">操作</th>
		</tr>
		</thead>
	</table>
	<script type="text/html" id="barDemo">
		<a class="layui-btn layui-btn-xs" lay-event="edit" style="width: 50px">修改</a>
	</script>
	<script>
		layui.use(['form','table'], function () {
			var table = layui.table,form = layui.form;
			table.on('tool(ComplainMessage)', function (obj) {
				var data = obj.data;
				var complain_id = data.complain_id;
				if (obj.event === 'edit') {
					layer.open({
						type: 2,
						title: '编辑信息',
						shadeClose: true,
						shade: 0.8,
						area: ['100%', '100%'],
						content: '{:url("/admin/ComplainMessage/edit","complain_id=")}' + complain_id //iframe的url
					});
				}
			});
			//搜索
			$('.layui-btn').on('click', function () {
				var complain_message 	= $("#complain_message").val();
				table.reload('ComplainMessage', {
					url: '/admin/ComplainMessage/index', where: {
						"complain_message": complain_message,
					}
				});
			});
		});

	</script>
</block>
